Skip to main content
Version: 1.0.2

Swap estimate

The Swap estimate API is used to fetch estimated amount for a swap transaction. By invoking this API, users can obtain an estimate amount of the swap transaction.

Method: POST

{{URL}}/jsonrpc

Headers

NameValue
Content-Typeapplication/json

Example

Payload Parameters
ParameterDescription

id

Mandatory

String

Represents the unique identifier associated with the swap estimate request.

Ex: "701001"

asset

Mandatory

String

Represents the source asset for the swap transaction.

Ex: "SRT"

issuer

Mandatory

String

Represents the issuer of the source asset.

Ex: ""

amount

Mandatory

String

Represents the amount of the source asset to be swapped.

Ex: "10"

destinationAsset

Mandatory

String

Represents the destination asset for the swap transaction.

Ex: "USDC"

destinationIssuer

Mandatory

String

Represents the issuer of the destination asset.

Ex: "GDBTV4ULJ5HG2N6YJSDGVL2XPQY3F33K2U7M6MGPJJ3KIG6EFENF56QW"

fee

Mandatory

String

Represents the fee amount for the swap transaction.

Ex: "100"


curl --location '{{url}}/rpc/WalletService/SwapEstimate' \
--header 'DiviceID: 8020' \
--header 'Signature: keyId=8020,algorithm=ecdsa-sha256,signature=MEUCIQCNi1vjPf/HpI9R2DXnc0Zt1s6YmWyA4H1x813lJ+tuDgIgB+lrc+iCMyTUGiraG9kGKNDXYiz7RfBBtifr5wUQs54=' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic e3tFbWFpbH19Ont7UGFzc3dvcmR9fQ==' \
--data '{"id":"701001","asset":"XLM","issuer":"","amount":"10","destinationAsset":"USDC","destinationIssuer":"GDBTV4ULJ5HG2N6YJSDGVL2XPQY3F33K2U7M6MGPJJ3KIG6EFENF56QW","fee":"100"}'

Body


{
"id": "701001",
"asset": "XLM",
"issuer": "",
"amount": "10",
"destinationAsset": "USDC",
"destinationIssuer": "GDBTV4ULJ5HG2N6YJSDGVL2XPQY3F33K2U7M6MGPJJ3KIG6EFENF56QW",
"fee": "100"
}

Response: 200

Response Parameters
ParameterDescription

estimateAmount

String

Represents the estimated amount of the destination asset to be received.

Ex: "9.9800399"

path

Array

quotationId

String

Represents the unique identifier for the swap quotation.

Ex: "865001"


{
"estimateAmount": "9.9800399",
"path": [],
"quotationId": "865001"
}